<?
session_start();
include('templates/header.php');

if (isset($_GET["id"])) {
    $id = $_GET["id"];
    $CLASS_APP = new app($mysqli);
    $item = $CLASS_APP->get_products_id($id);
}
?>

    <h1><?= $item["product"] ?></h1>

    <div class="inner-content">
        <img src="admin/<?= $img_dir . $item["file"] ?>" alt="product-image">

        <div class="inner-details">
            <strong><?= $item["price"] ?> €</strong><br>
            <?
            if ($CLASS_APP->check_product_stock($item["id_products"]) > 0) {
                ?>
                <button onclick="addItem(<?= $item["id_products"] ?>)" class="btn_buy">ADD TO CART</button><?
            }
            ?>
        </div>
    </div>

    <h2>Details</h2>
    <p><?= $item["description"] ?></p>

<? include('templates/footer.php'); ?>